package com.fosu.service.impl;

import com.fosu.common.ResponseResult;
import com.fosu.domain.Carousel;
import com.fosu.dao.*;
import com.fosu.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Desription
 * 轮播图业务实现类
 * @author manno
 * @date 2020/10/19
 */
@Service
public class CarouselServiceImpl implements CarouselService
{
    @Autowired
    private CarouselDao carouselDao;

    @Override
    public ResponseResult getCarousels( HttpServletResponse resp)
    {
        List<Carousel> carousels = carouselDao.getCarousels();
        if (carousels.size() > 0)
        {
            return ResponseResult.build(resp,200,10007,"获取轮播图成功",carousels);
        }
        return ResponseResult.build(resp,500,10008,"获取轮播图为空或失败",carousels);
    }
}
